package com.sumainfor.pc.epc.controller;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.epc.feign.Housingauditfeign;
import com.sumainfor.pc.epc.service.DecorateplanService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@RequestMapping("/DecorateplanContrcoller")
public class DecorateplanContrcoller {
    @Autowired
    private DecorateplanService decorateplanService;

    @Autowired
    private Housingauditfeign housingauditfeign;
    Logger log = LoggerFactory.getLogger(DecorateplanContrcoller.class);// 日志

    /**
     * 装修计划删除某一个房源
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("deleDecoratePlanInfo")
    public JsonResult deleDecoratePlanInfo(@RequestParam Map<String,Object> params){

        return decorateplanService.deleDecoratePlanInfo(params);
    }

    /**
     * 根据装修计划id 查询出详情
     *
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("getDecorationPlanForDetails")
    public JsonResult getDecorationPlanForDetails(@RequestParam Map<String, Object> params) {

        return decorateplanService.getDecorationPlanForDetails(params);
    }
    /**
     * 查询
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("getPlan_deploy")
    public JsonResult getPlan_deploy(@RequestParam Map<String, Object> params) {

        return decorateplanService.getPlan_deploy(params);
    }

      /**
     * 修改装修计划中的某个房源的供应商
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updatePlanInfobySupId")
    public JsonResult updatePlanInfobySupId(@RequestParam Map<String, Object> params) {

        return decorateplanService.updatePlanInfobySupId(params);
    }

    /**
     * 根据商品名称查询归属的房源
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("getHouId")
    public JsonResult getHouId(@RequestParam Map<String, Object> params) {

        return decorateplanService.getHouId(params);
    }

    /**
     * 按照商品类型查询其他商品
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("getcommodityBytype")
    public JsonResult getcommodityBytype(@RequestParam Map<String, Object> params){
        return decorateplanService.getcommodityBytype(params);
    }

    /**
     * 查询单个房源的装修精度
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("gettcepchousingplaninfo")
    public JsonResult gettcepchousingplaninfo(@RequestParam Map<String, Object> params){
        return decorateplanService.gettcepchousingplaninfo(params);
    }
    /**
     * 按照房源id 查询 单个房源的其他费用
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("gethousing_plan_infoSupId")
    public JsonResult gethousing_plan_infoSupId(@RequestParam Map<String, Object> params){
        return decorateplanService.gethousing_plan_infoSupId(params);
    }

    /**
     * 按照其他费用id删除一个其他费用
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("deleterests")
    public JsonResult deleterests(@RequestParam Map<String, Object> params){
        return decorateplanService.deleterests(params);
    }

    /**
     * 按照其他费用id删除一个其他费用
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("saverests")
    public JsonResult saverests(@RequestBody Map<String, Object> params){
        return decorateplanService.saverests(params);
    }

    /**
     * 按照其他费用id删除一个其他费用
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("savesrests")
    public JsonResult savesrests(@RequestBody Map<String, Object> params){
        log.info("params==>"+params);
        return decorateplanService.savesrests(params);
    }

    /**
     * 按照其他费用id删除一个其他费用
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updaterests")
    public JsonResult updaterests(@RequestBody Map<String, Object> params){

        log.info("params======>"+params);
        return decorateplanService.updaterests(params);
    }

    /**
     * 点击完成土建阶段
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updateCivilState")
    public JsonResult updateCivilState(@RequestParam Map<String, Object> params){
        return decorateplanService.updateCivilState(params);
    }

    /**
     * 点击完成验房阶段
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updateCheckState")
    public JsonResult updateCheckState(@RequestParam Map<String, Object> params){
        return decorateplanService.updateCheckState(params);
    }

    /**
     * 点击完成建设阶段
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updateFitmentState")
    public JsonResult updateFitmentState(@RequestParam Map<String, Object> params){
        return decorateplanService.updateFitmentState(params);
    }

    /**
     * 点击完成建设阶段
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updatedeploybyDepId")
    public JsonResult updatedeploybyDepId(@RequestParam Map<String, Object> params){
        return decorateplanService.updatedeploybyDepId(params);
    }

    /**
     * 提交验房
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updateCheckNoticeTime")
    public JsonResult updateCheckNoticeTime(@RequestParam Map<String, Object> params){
        return decorateplanService.updateCheckNoticeTime(params);
    }


    /**
     * 再次验房
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updateIfCheckState")
    public JsonResult updateIfCheckState(@RequestParam Map<String, Object> params){
        return decorateplanService.updateIfCheckState(params);
    }

    /**
     *
     * 停用
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updateIdentifier")
    public JsonResult updateIdentifier(@RequestParam Map<String, Object> params){
        return decorateplanService.updateIdentifier(params);
    }

    /**
     *
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("upodateAerTowpojo")
    public JsonResult upodateAerTowpojo(@RequestParam Map<String, Object> params){
        return decorateplanService.upodateAerTowpojo(params);
    }



    /**
     *
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("updatetinfo")
    public JsonResult updatetinfo(@RequestBody Map<String, Object> params){
        log.info("params:"+params);

        return decorateplanService.housing_plan_info(params);
    }

    /**
     *
     * @param params
     * @return
     */
    @ResponseBody
    @RequestMapping("gettcmkt_housingByHouId")
    public JsonResult gettcmkt_housingByHouId(@RequestParam Map<String, Object> params){
        log.info("params:"+params);

        return housingauditfeign.gettcmkt_housingByHouId(params);
    }
    /**
     * 新增
     *编辑装修计划修改智能设备
     */
    @ResponseBody
    @PostMapping("/updateHpiInte")
    public JsonResult updateHpiInte(@RequestBody Map<String, Object> params){
        return decorateplanService.updateHpiInte(params);
    }

}
